package chan.module.project.hw.mrs.obs.v350;

import com.obs.services.ObsClient;
import com.obs.services.model.ObjectListing;
import com.obs.services.model.S3Object;

public class MRSOBSV350Main {
    public static void main(String[] args) throws Exception {
        // 配置OBS连接信息
        String endPoint = "obsv3.cscec-xcy-01.cscec.com";
        String ak = "CJDLZIUQZXOOFMEGVI96";
        String sk = "a1lZQcdM15CtQr9cZfH8FRY4k2QrCd54Ed4GWbry";
        String bucketName = "obs-daas-gxjh-test";
        String fileName = "dxp_load/S_f661caab7be4488286c57274474f8fb6-1755071518041.json";
        // 创建OBS客户端
        ObsClient obsClient = new ObsClient(ak, sk, endPoint);

        ObjectListing objectListing = obsClient.listObjects(bucketName);
        for (S3Object obsObjectSummary : objectListing.getObjectSummaries()) {
            System.out.println("Object Key: " + obsObjectSummary.getObjectKey() );
        }


        /*// 创建上传请求
        String objectKey = "dxp_out.log";
        File file = new File("/dxp_out.log"); //待上传文件
        PutObjectRequest request = new PutObjectRequest(bucketName, objectKey, Files.newInputStream(file.toPath()));
        // 执行上传操作
        obsClient.putObject(request);*/
        // 关闭OBS客户端
        obsClient.close();
    }
}